"""Definition of the Video content type
"""

from zope.interface import implements

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata
from Products.ATContentTypes.interfaces import IATFile
from Products.ATContentTypes.content.file import ATFileSchema
from Products.ATContentTypes.content.file import ATFile as BaseClass
# -*- Message Factory Imported Here -*-

from apkn.workspaces.interfaces import IVideo
from apkn.workspaces.config import PROJECTNAME
from apkn.workspaces import workspacesMessageFactory as _
import logging

VideoSchema = ATFileSchema.copy() + atapi.Schema((

))


schemata.finalizeATCTSchema(VideoSchema, moveDiscussion=False)


class Video(BaseClass):
    """Video"""
    implements(IATFile, IVideo)

    meta_type = "Video"

    # :: Filter addable file extensions
    assocFileExt = ('flv', 'mp4', '.f4v')
    schema = VideoSchema

    try:
        schema['file'].widget.label = _('Video')
        schema['file'].widget.description = \
            _('Select a .flv or .mp4 or .f4v video file to upload')
    except:
        logging.error('Failed to configure video schema widget info')

'''    def manage_afterPUT(self, data, marshall_data, file, context, mimetype, filename, REQUEST, RESPONSE):
        is_new = False
        title = self.Title()
        if not title:
            is_new = True
        '''

atapi.registerType(Video, PROJECTNAME)
